<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    .container{
       width: 500px;
       background-color: #333;
    }
    .box1{
        width: 100px;
        height: 100px;
        background-color: aqua;
        margin: 5px;
        float: left;
    }
    .text{
        width: 100px;
        height: 100px;
        background-color: #c043b7;
        clear: both;

    }
    .container::after{
        content:"";
        display: block;
        clear: both;
    }
</style>
<body>
    <!-- 浮动副作用 
      浮动元素会造成父元素高度塌陷,后续元素会受到影响
      
      解决方法：父元素设置高度
               受影响的元素增加clear属性 both
               overflow清除浮动 hidden->父类
               伪对象方式
    -->

   <div  class="container">
      <div class="box1"></div>
      <div class="box1"></div>
      <div class="box1"></div>
      <div class="text"></div>
   </div>


</body>
</html>